```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MySQL性能指标深度解析：QPS与TPS</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .formula-box {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 12px;
        }
        .highlight-box {
            border-left: 4px solid #4f46e5;
            background-color: #f8fafc;
        }
        .code-block {
            font-family: 'Courier New', Courier, monospace;
            background-color: #2d3748;
            color: #f7fafc;
        }
        .mermaid-container {
            background-color: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl flex flex-col items-center">
            <div class="flex items-center mb-4">
                <span class="bg-white bg-opacity-20 rounded-full p-2 mr-3">
                    <i class="fas fa-database text-xl"></i>
                </span>
                <span class="uppercase tracking-wider text-sm font-semibold">数据库性能优化</span>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold text-center mb-6 leading-tight">
                MySQL性能核心指标<br>QPS与TPS深度解析
            </h1>
            <p class="text-xl text-center max-w-3xl opacity-90 mb-10">
                掌握数据库性能监控与优化的关键指标，提升系统吞吐量与响应速度
            </p>
            <div class="flex flex-wrap justify-center gap-4">
                <div class="bg-white bg-opacity-10 rounded-lg p-4 backdrop-blur-sm">
                    <div class="text-xs uppercase tracking-wider mb-1 opacity-80">查询性能</div>
                    <div class="text-2xl font-bold">QPS</div>
                    <div class="text-sm opacity-80">每秒查询数</div>
                </div>
                <div class="bg-white bg-opacity-10 rounded-lg p-4 backdrop-blur-sm">
                    <div class="text-xs uppercase tracking-wider mb-1 opacity-80">事务处理</div>
                    <div class="text-2xl font-bold">TPS</div>
                    <div class="text-sm opacity-80">每秒事务数</div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Definition Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-3">1</span>
                QPS和TPS的定义
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- QPS Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4">
                                <i class="fas fa-search text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">QPS</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            QPS(Queries Per Second)指的是每秒钟数据库能够处理的查询请求数量。它是衡量数据库查询处理能力的重要指标，反映了系统在单位时间内的查询负载。
                        </p>
                        <div class="highlight-box p-4 mb-4">
                            <p class="font-medium">
                                <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                适用场景：通常用于评估数据库在高并发读操作下的表现
                            </p>
                        </div>
                    </div>
                </div>
                
                <!-- TPS Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-full bg-purple-100 text-purple-600 flex items-center justify-center mr-4">
                                <i class="fas fa-exchange-alt text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold">TPS</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            TPS(Transactions Per Second)指的是每秒钟数据库能够处理的事务数量。事务通常包含多个SQL操作，因此TPS不仅反映查询能力，还包括写操作、事务提交等复杂操作。
                        </p>
                        <div class="highlight-box p-4">
                            <p class="font-medium">
                                <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                                适用场景：通常用于评估数据库在并发写操作下的性能
                            </p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Visualization -->
            <div class="bg-white rounded-xl shadow-md p-6 mb-12">
                <h3 class="text-xl font-semibold mb-6 flex items-center">
                    <i class="fas fa-project-diagram text-indigo-500 mr-2"></i>
                    QPS与TPS关系图解
                </h3>
                <div class="mermaid-container">
                    <div class="mermaid">
                        graph TD
                            A[客户端请求] -->|读操作| B(QPS)
                            A -->|写操作| C(TPS)
                            B --> D[查询处理]
                            C --> E[事务处理]
                            D --> F[返回结果]
                            E --> F
                            style B fill:#6366f1,color:white
                            style C fill:#8b5cf6,color:white
                    </div>
                </div>
            </div>
        </section>

        <!-- Calculation Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 flex items-center">
                <span class="w-8 h-8 rounded-full bg-indigo-600 text-white flex items-center justify-center mr-3">2</span>
                QPS与TPS的计算方法
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- QPS Calculation -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-2xl font-semibold mb-4 flex items-center">
                            <i class="fas fa-calculator text-indigo-500 mr-2"></i>
                            QPS计算方法
                        </h3>
                        <div class="formula-box p-4 mb-4 bg-indigo-50 rounded-lg">
                            <p class="text-center font-mono text-lg font-bold text-indigo-700">
                                QPS = 查询总数 / 时间段内的秒数
                            </p>
                        </div>
                        <ol class="list-decimal pl-5 space-y-2 text-gray-700">
                            <li>获取数据库在特定时间段内执行的查询总数</li>
                            <li>计算时间段内的秒数</li>
                            <li>用查询总数除以秒数，得到QPS</li>
                        </ol>
                        <div class="mt-6">
                            <h4 class="font-semibold mb-2 flex items-center">
                                <i class="fas fa-terminal text-gray-500 mr-2"></i>
                                实践操作
                            </h4>
                            <div class="code-block p-4 rounded-lg mb-4">
                                <code class="text-green-300">SHOW GLOBAL STATUS LIKE 'Queries';</code>
                            </div>
                            <p class="text-sm text-gray-600">
                                通过记录两次查询之间的<code class="bg-gray-100 px-1 rounded">Queries</code>值差，可以得到该时间段内的QPS。
                            </p>
                        </div>
                    </div>
                </div>
                
                <!-- TPS Calculation -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-2xl font-semibold mb-4 flex items-center">
                            <i class="fas fa-calculator text-purple-500 mr-2"></i>
                            TPS计算方法
                        </h3>
                        <div class="formula-box p-4 mb-4 bg-purple-50 rounded-lg">
                            <p class="text-center font-mono text-lg font-bold text-purple-700">
                                TPS = 事务总数 / 时间段内的秒数
                            </p>
                        </div>
                        <ol class="list-decimal pl-5 space-y-2 text-gray-700">
                            <li>获取特定时间段内的事务总数</li>
                            <li>计算时间段内的秒数</li>
                            <li>用事务总数除以秒数，得到TPS</li>
                        </ol>
                        <div class="mt-6">
                            <h4 class="font-semibold mb-2 flex items-center">
                                <i class="fas fa-terminal text-gray-500 mr-2"></i>
                                实践操作
                            </h4>
                            <div class="code-block p-4 rounded-lg mb-2">
                                <code class="text-green-300">SHOW GLOBAL STATUS LIKE 'Com_commit';</code><br>
                                <code class="text-green-300">SHOW GLOBAL STATUS LIKE 'Com_rollback';</code>
                            </div>
                            <p class="text-sm text-gray-600">
                                通过记录两次查询之间<code class